package com.ebelter.btcomlib.models.bluetooth.products.dianji8.bean;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 用户池
 */

public class Dj8Users {
    private static Dj8Users instance;
    private Dj8Users(){}
    public static Dj8Users getInstance() {
        if (instance==null){
            synchronized (Dj8Users.class){
                if (instance==null) instance=new Dj8Users();
            }
        }
        return instance;
    }
    //===================================================

    private Map<String,Dj8ScaleUserInfo> usersMap = new LinkedHashMap<>();

    public void clearUsers(){
        usersMap.clear();
    }

    public void addUser(Dj8ScaleUserInfo dj8ScaleUserInfo){
        Dj8ScaleUserInfo u=new Dj8ScaleUserInfo();
        u.setUserId(dj8ScaleUserInfo.getUserId());
        u.setAge(dj8ScaleUserInfo.getAge());
        u.setSex(dj8ScaleUserInfo.getSex());
        u.setHeight(dj8ScaleUserInfo.getHeight());
        u.setRole(dj8ScaleUserInfo.getRole());
        u.setWeight(dj8ScaleUserInfo.getWeight());
        usersMap.put(dj8ScaleUserInfo.getUserId()+"",u);
    }

    public Dj8ScaleUserInfo getUser(String userid){
        return usersMap.get(userid);
    }






}
